package
{
	import alternativa.gui.enum.Align;
	import alternativa.gui.layout.LayoutManager;
	import alternativa.gui.mouse.CursorManager;
	import alternativa.gui.mouse.MouseManager;
	import alternativa.gui.theme.defaulttheme.controls.text.TextInput;
	import alternativa.gui.theme.defaulttheme.init.DefaultTheme;
	import alternativa.gui.theme.defaulttheme.primitives.base.Hint;
	import alternativa.gui.theme.defaulttheme.skin.Cursors;
	import alternativa.init.GUI;
	
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.events.Event;
	import flash.system.Security;
	import flash.system.System;
	
	import globals.Global;
	
	import mvc.AppFacade;
	import mvc.Notifications;
	import mvc.views.AppMainView;

	[SWF(backgroundColor="#ffffff", frameRate="24", width="1000", height="600")]
	public class SRWeb extends Sprite
	{
		private var appMainView:AppMainView;
		
		public function SRWeb()
		{
			Security.allowDomain("*");
			addEventListener(Event.ADDED_TO_STAGE,added);
		}
		
		private function added(evt:Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE,added);
			
			init();
		}
		
		internal function init():void
		{
			onResize(null);
			
			this.mouseEnabled = false;
			this.tabEnabled = false;
			
			appMainView = new AppMainView();
			var facade:AppFacade = AppFacade.getInstance();
			facade.startup({app:this,appView:appMainView});
			
			mouseEnabled = false;
			tabEnabled = false;
			
			stage.addEventListener(Event.RESIZE,onResize);
		}
		
		internal function onResize(evt:Event):void
		{
			Global.stage = stage;
			Global.stageW = stage.stageWidth<1000?1000:stage.stageWidth;
			Global.stageH = stage.stageHeight<600?600:stage.stageHeight;
			AppFacade.getInstance().sendNotification(Notifications.MEDIATOR_APP_RESIZE);
			
		}
	}
}
